Network batching - #631
Merged
Merged
Conversation
MykolaSuperman
force-pushed
the
network-batching
branch
4 times, most recently
from
July 24, 2026 10:02
d5515bd to
e91ea36
Compare
al1img
reviewed
Jul 30, 2026
| EXPECT_CALL(mBandwidth, Clear(_)).Times(times).WillRepeatedly(Return(aos::ErrorEnum::eNone)); | ||
| EXPECT_CALL(mFirewall, RemoveInstance(_)).Times(times).WillRepeatedly(Return(aos::ErrorEnum::eNone)); | ||
| EXPECT_CALL(mBridgeNetwork, Detach(_, _)).Times(times).WillRepeatedly(Return(aos::ErrorEnum::eNone)); | ||
| // The host veth is no longer detached synchronously on stop; the instance |
Collaborator
There was a problem hiding this comment.
This comment makes no sense without the removed line.
| Launcher::InstanceData* Launcher::FindInstanceDataByID(const String& instanceID) | ||
| { | ||
| auto it = mInstances.FindIf([&instanceID](const auto& instance) { return instance.mInstanceID == instanceID; }); | ||
|
|
mykola-kobets-epam
approved these changes
Jul 30, 2026
mykola-kobets-epam
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed-by: Mykola Kobets <mykola_kobets@epam.com>
MykolaSuperman
force-pushed
the
network-batching
branch
2 times, most recently
from
August 3, 2026 15:37
18b983d to
4ce7f00
Compare
mlohvynenko
approved these changes
Aug 4, 2026
mlohvynenko
left a comment
Member
There was a problem hiding this comment.
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
al1img
approved these changes
Aug 4, 2026
al1img
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
added 16 commits
August 4, 2026 11:26
…nc detach Stop no longer deletes the host veth synchronously. DeleteNetworkNamespace drops the instance netns (lazy MNT_DETACH umount); the kernel then reaps the peer veth - and the host end with it, since they die as a pair - asynchronously via cleanup_net, off the critical stop path. The synchronous per-instance delete blocked on a kernel RCU grace period for every instance, serialized under rtnl_lock (O(N) on mass teardown): measured ~2.5s to delete 200 host veths one-by-one vs ~0.25s for the lazy namespace teardown (which also lets cleanup_net batch the unregister). No leak: the interfaces are gone once the namespace is reaped. Detach is kept for the AddInstanceToNetwork rollback path, where the namespace may not yet own the peer. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
DeleteInstanceNetworkConfig only calls Bandwidth::Clear when the instance config actually had a non-zero ingress/egress limit. For unlimited instances (the common case) nothing was installed, so the previous unconditional Clear just wasted three tc round-trips (serialized on rtnl_lock) per instance on a mass teardown. The decision uses the config already held in the network manager, so no extra state is kept in the bandwidth backend. Tests to be updated separately. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
…ilure Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
…stances Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
… fallback Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Discarding a staged batch without applying it is not expressible with FlushBatch/Revert: FlushBatch commits and Revert undoes an already applied batch. Add AbortBatch to both backend interfaces and mocks. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
FlushBatch commits the firewall, traffic-monitor and storage backends in sequence and gives each failure its own recovery so a partial batch never leaves one backend applied while another is not: a firewall-flush failure aborts the still-staged traffic batch, a traffic-flush failure reverts the already-flushed firewall, and a storage-commit failure reverts both. The storage transaction is rolled back on every failure path, and the batch entries are re-applied per instance so one bad instance is isolated instead of failing the whole flush. Cover the firewall-, traffic- and commit-failure paths with tests. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
ReconcileInstances registered the network DNS server (AdoptDNSServer) only
on the leftover-cleanup path, not for instances adopted as running via
InitInstance. DeleteInstanceNetworkConfig then could not find the DNS
server ("DNS server not found for cleanup") and left stale addnhosts
entries when such an instance was later removed.
Adopt the DNS server before continuing the running-instance branch too.
AdoptDNSServer is idempotent, so multiple instances on one network are
safe; a failure is logged and does not abort adoption.
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Mykola Kobets <mykola_kobets@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Adopt a running leftover instance on restart, assert the network DNS server is registered (CreateServer), and that a subsequent StopInstanceNetwork drops the instance host entry (RemoveHost). Without the reconcile fix neither call happens, so the test fails. Update Start_KeepsLeftoverInstanceWithLiveInterface to expect the DNS server adoption too. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com> Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
MykolaSuperman
force-pushed
the
network-batching
branch
from
August 4, 2026 08:27
4ce7f00 to
06f9dc0
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No description provided.